<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="other" tagdir="/WEB-INF/tags/other"%>
<%@ taglib prefix="customer" tagdir="/WEB-INF/tags/customer"%>
<probiz:pageHeading pageHeadingKey="customerList.title" />
<head>
	<c:if test="${not empty param.direct}">
		<c:set var="hideMainDiv" value="true" scope="request"/>
	</c:if>
</head>
 
<content tag="buttons">
	<authorize:authorizeResource resourceString="/customer/customer.html?direct=add*">
		<probiz:iconBtn btnType="add" onclick="createCustomer();" />
	</authorize:authorizeResource>	
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=*elete*">
		<probiz:iconBtn btnType="delete" id="multiDelete" onclick="deleteCustomers()" />
	</authorize:authorizeResource>
	<div class="line"></div>
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=multiActive*">
		<probiz:iconBtn btnType="active"  onclick="activeCustomers()" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=multiForbid*">
		<probiz:iconBtn btnType="forbid"  onclick="forbidCustomers()" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=sendMail*">
		<probiz:iconBtn btnType="email" id="multiSendMail" onclick="openSendEmailDialog()" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=sendSMS*">
		<probiz:iconBtn btnType="msg" id="multiSendSystemMsg" onclick="openSendSystemMsgDialog()" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=sendSystemMsg*">
		<probiz:iconBtn btnType="sms" id="multiSendSms" onclick="openSendSmsDialog()" />
	</authorize:authorizeResource>
	<verFunc:verFuncValidate funcKey="tag">
	<div class="line"></div>
		<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=save*">
			<other:tagSelector selectorId="tagSelector" module="4" left="-25" applyCallbackFunc="applyTags" manageCallbackFunc="manageTags"/>
		</authorize:authorizeResource>	
	</verFunc:verFuncValidate>
	<div class="line"></div>
	<authorize:authorizeResource resourceString="/tool/customerExport/dialog.html?doAction=outputExcel*">
		<probiz:iconBtn btnType="export" onclick="outExcel();" />
	</authorize:authorizeResource>
	<authorize:authorizeResource resourceString="/tool/customerImport.html*">
		<probiz:iconBtn btnType="import" url="${ctxPath}/tool/customerImport.html" />
	</authorize:authorizeResource>
</content>


<div id="customerList">
	<%@include file="include/customerSearchCriteria.jspf"%>
	
	<div id="customerResults" name="customerResults">
		<%--ajaxLoad file="/customer/include/customerListBody.jspf" --%>
		<%@include file="include/customerSearchCriteriaStorage.jspf"%>
	</div>
</div>

<%---------------------------------start:发送邮件 -------------------------%>
<div style="display:none">
	<fmt:message key="button.sendEmail" var="buttonSendEmail"/>
	<fmt:message key="button.cancel" var="buttonCancel"/>
	<fmt:message key="customerEmailDialog.title" var="title"/>
	<probiz:ui_dialog id="sendEmailDlg" width="640" height="400" title="${title}" buttons="'${buttonSendEmail}':sendEmail,'${buttonCancel}':closeSendEmailDialog">
		<%@include file="include/customerListEmail.jspf"%>
	</probiz:ui_dialog>
</div>
<%---------------------------------end:  发送邮件 -------------------------%>

<%---------------------------------start:发送系统消息 -------------------------%>
<div style="display:none">
	<fmt:message key="button.sendSystemMsg" var="buttonSendsystemMsg"/>
	<fmt:message key="button.cancel" var="systemMsgButtonCancel"/>
	<fmt:message key="customerSystemMsgDialog.title" var="systemMsgTitle"/>
	<probiz:ui_dialog id="sendSystemMsgDlg" width="640" height="400" title="${systemMsgTitle}" buttons="'${buttonSendsystemMsg}':sendSystemMsg,'${systemMsgButtonCancel}':closeSendSystemMsgDialog">
		<%@include file="include/customerListSystemMsg.jspf"%>
	</probiz:ui_dialog>
</div>
<%---------------------------------end:  发送系统消息 -------------------------%>

<%---------------------------------start:重设密码 -------------------------%>
<div style="display:none">
	<fmt:message key="button.save" var="buttonSave"/>
	<fmt:message key="button.cancel" var="buttonCancel"/>
	<fmt:message key="appUser.password.reset.title" var="title"/>
	<probiz:ui_dialog id="resetPasswordDialog" width="640" height="220" title="${title}"
		url="${ctxPath}/customer/customer/blank.html?doAction=resetPassword" buttons="'${buttonSave}':saveResetPassword,'${buttonCancel}':dlgresetPasswordDialog_close" />
</div>
<%---------------------------------end:  重设密码 -------------------------%>

<%---------------------------------start:发送短信 -------------------------%>
<div style="display:none">
	<fmt:message key="button.sendSms" var="buttonSms"/>
	<fmt:message key="button.cancel" var="smsButtonCancel"/>
	<fmt:message key="customerSmsDialog.title" var="smsTitle"/>
	<probiz:ui_dialog id="sendSmsDlg" width="640" height="400" title="${smsTitle}" buttons="'${buttonSms}':sendSms,'${smsButtonCancel}':closeSendSmsDialog">
		<%@include file="include/customerListSms.jspf"%>
	</probiz:ui_dialog>
</div>
<%---------------------------------end:  发送短信 -------------------------%>



<%-----start:list需要加载的JS ----%>
<c:set var="probizJs_regionLinkage" value="true" scope="request"/>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/customer/customerListForTags.js?rs=${appConfig.rs}"></script>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/customer/customerList.js?rs=${appConfig.rs}"></script>

<%-----end:  list需要加载的JS ----%>

<%-----start:form需要加载的JS ----%>
<c:set var="plugin_upload" value="true" scope="request"/>
<c:set var="ui_dialog" value="true" scope="request"/>
<c:set var="ui_tabs" value="true" scope="request"/>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/customer/customerForm.js?rs=${appConfig.rs}"></script>
<%-----end:  form需要加载的JS ----%>

<script type="text/javascript">
$j(document).ready(function () {
	__FMTExtend = {
		customerList_selectCustomer:"<fmt:message key="customerList.selectCustomer"/>",
	    customerForm_saveCustomer_success:"<fmt:message key="customerForm.saveCustomer.success"/>",
	    passwordReset_success:"<fmt:message key="passwordReset.success"/>",
	    customerDetail_adjustShopPoint_success:"<fmt:message key="customerDetail.adjustShopPoint.success"/>",
	    customerDetail_adjustShopPoint_false:"<fmt:message key="customerDetail.adjustShopPoint.false"/>",
	    sms_customer_notmobilePhone:"<fmt:message key="sms.customer.notmobilePhone"/>"
	};
	$j.extend(__FMT, __FMTExtend); 
});	

$j(document).ready(function () {
	<c:choose>
		<c:when test="${not empty param.membershipId}">
			searchCustomers(true,{membershipId:${param.membershipId}});
		</c:when>
		<c:otherwise>
			searchCustomers(true,'');
		</c:otherwise>
	</c:choose>
	
	<c:if test="${(not empty param.direct) and (param.direct == 'add')}">
		createCustomer();
	</c:if>
	<c:if test="${not empty param.customerId}">
		editCustomer(${param.customerId});
	</c:if>
	
});

function outExcel(){
	var paraData=$j("#customerListForm :input[name='multiIds']").serialize();
	window.location = "${ctxPath}/tool/customerExport/dialog.html?doAction=outputExcel&" + paraData;
}
</script>

